from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from app.api.websocket_handler import websocket_endpoint

app = FastAPI()

# 测试网页
@app.get("/")
async def get():
    with open("templates/index.html", "r", encoding="utf-8") as file:
        html_content = file.read()
    return HTMLResponse(content=html_content)

app.websocket("/ws")(websocket_endpoint)